<template>
  <div class="app-container">
    <p>近一个月国家销售排行（销售金额累计TOP10）</p>
    <div class="chart-wrapper-box">
      <el-table
        :header-cell-style="{'text-align':'center'}"
        :cell-style="{'text-align':'center'}"
        :data="gjxsData"
        border
        style="width: 100%"
        v-loading="gjxsloading"
      >
        <el-table-column prop="index" label="序号" width="50">
        </el-table-column>
        <el-table-column prop="countryName" label="国家"></el-table-column>
        <el-table-column prop="orderNumber" label="订单数"/>
        <el-table-column prop="saleNumber" label="销售金额"/>
        <el-table-column prop="profitAmount" label="利润"/>
        <el-table-column prop="profitRate" label="利润率"/>
      </el-table>
      <pagination
        v-show="gjxstotal>0"
        :total="gjxstotal"
        :page.sync="gjxsParams.pageNum"
        :limit.sync="gjxsParams.pageSize"
        @pagination="getHeadOfficeCountrySaleRankingMonthData"
      />
    </div>
  </div>
</template>

<script>
import {HeadOfficeCountrySaleRankingMonthData} from "@/api/index";

export default {
  name: "countryData",
  data() {
    return {
      gjxsData: [],
      gjxsloading: false,
      gjxstotal: 0,
      gjxsParams: {
        pageNum: 1,
        pageSize: 10
      }
    }
  },
  created() {
    this.getHeadOfficeCountrySaleRankingMonthData()
  },
  methods:{
    // 近一个月国家销售排行（销售金额累计TOP10）
    getHeadOfficeCountrySaleRankingMonthData() {
      this.gjxsloading = true;
      HeadOfficeCountrySaleRankingMonthData(this.gjxsParams).then(res => {
        this.gjxsData = res.records;
        this.gjxstotal = res.total;
        this.gjxsloading = false;
      })
    }
  }
}
</script>

<style scoped>

</style>
